<?php namespace web\home\controller;
/** .-------------------------------------------------------------------
 * |  Software: [HDPHP framework]
 * |      Site: www.hdphp.com
 * |-------------------------------------------------------------------
 * |    Author: 向军 <2300071698@qq.com>
 * |    WeChat: aihoudun
 * | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved.
 * '-------------------------------------------------------------------*/

class Common {
	//构造函数	
	public function __construct(){
		$this->auth();

		if($_SESSION['id']){
			$userData=Db::table('user')->where('uid',$_SESSION['id'])->first();
			View::with('userData',$userData);
//			p($userData);die;
		}
	}
//	验证session中id是否存在
	private function auth(){
		if(!isset($_SESSION['id'])){
			go(U('home/user/login'));
		}
	}
	
	
}